package ex2.SearchingAndSorting.cn.edu.besti.cs1723.GK2301;
public class SearchingTest {
    public static void main(String[] args) {
        Searching searching = new Searching();

        Comparable[] a = new Comparable[]{1,5,7,16,23,50,65,98,116,120,177};

        int[] c = new int[]{1,5,7,16,23,50,65,98,116,120,177};

        System.out.println("数组：");
        for (Comparable b : a)
        {
            System.out.print(b + " ");
        }
        System.out.println();
        Comparable target1 = 10;
        Comparable target2 = 5;
        Comparable target3 = 23;
        Comparable target4 = 116;
        Comparable target5 = 177;
        Comparable target6 = 50;

        System.out.println("线性查找能否找到10：" + searching.linearSearch(a,0,10,target1));
        System.out.println("二分查找能否找到5：" + searching.binarySearch(a,0,10,target2));
        System.out.println("插值查找能否找到23：" + searching.InterpolationSearch(a,0,10,target3));
        System.out.println("斐波那契查找能否找到116：" + searching.FibonacciSearch(a,0,10,target4));
        System.out.println("二叉查找树查找能否找到177：" + searching.BinarySearchTreeSearch(a,0,10,target5));
        System.out.println("分块查找能否找到50：" + searching.partitionSearch(a,0,10,target6));
        System.out.println("哈希查找能否找到98：" + searching.hashSearch(c,100));
    }
}
